package com.example.a2205douyin.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.a2205douyin.R;
import com.example.a2205douyin.entity.VideoEntity;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

import java.util.List;

public class LiveAdapter extends BaseQuickAdapter<VideoEntity.DataBean, BaseViewHolder> {
    public LiveAdapter(int layoutResId, @Nullable List<VideoEntity.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, VideoEntity.DataBean bean) {
        holder.setText(R.id.tv_user,bean.getAuthname());
        ImageView iv = holder.findView(R.id.iv);
        Glide.with(getContext()).load(bean.getHeadpath()).circleCrop().into(iv);
        StandardGSYVideoPlayer gsy = holder.findView(R.id.gsy);
        gsy.setUp(bean.getVideopath(),true,"");
        gsy.getBackButton().setVisibility(View.GONE);
        gsy.startPlayLogic();
        if(bean.getGuanzhu()==1){
            holder.setText(R.id.tv_guanzhu,"粉丝");
        }else{
            holder.setText(R.id.tv_guanzhu,"关注");
        }
    }
}
